import request from '@/utils/request'

/**
 * 获取用户频道
 * @returns Promise
 */
export const getChannelsAPI = () =>
  request({
    url: '/v1_0/user/channels'
  })

/**
 *  获取所有频道
 * @returns Promise
 */
export const getAllChannelsAPI = () =>
  request({
    url: '/v1_0/channels'
  })

/**
 *  删除我的频道
 * @param {Number} target 频道ID
 * @returns Promise
 */
export const delChannelsAPI = (target) =>
  request({
    url: `/v1_0/user/channels/${target}`,
    method: 'DELETE'
  })
/**
 *
 * @param {Number} id 频道的id
 * @param {Number} seq 添加的索引值
 * @returns Promise
 */
export const addChannelsAPI = (id, seq) =>
  request({
    url: '/v1_0/user/channels',
    method: 'PATCH',
    data: {
      channels: [{ id, seq }]
    }
  })
